public class test3 {
    List<Integer> res;
    public List<Integer> inorderTraversal(TreeNode root) {
        res = new ArrayList<>();
        inOrder(root);
        return res;
    }
    private void inOrder(TreeNode root){
        if(root==null){
            return;
        }
        //左中右
        inOrder(root.left);
        res.add(root.val);
        inOrder(root.right);
    }
}
